package net.htjs.juc.thread;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

//@Slf4j(topic = "c.Test1")
@Slf4j
public class ThreadLockPark {

    public static void main(String[] args) {
        Thread thread = new Thread(() ->{
            log.info("park");
            LockSupport.park();
            log.info("unpark");
            log.info("打断状态:{}", Thread.currentThread().isInterrupted());
            Thread.interrupted();
            log.info("park");
            LockSupport.park();
            log.info("unpark");
        }, "Thread1");
        try {
            thread.start();
            TimeUnit.SECONDS.sleep(1);
            thread.interrupt();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
